package com.example.shopping.mapper;

import com.example.shopping.pojo.Orders;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.core.annotation.Order;

import java.util.List;

public interface OrdersMapper {

    @Update("""
            update orders set status = #{status} where ordersId = #{ordersId};
            """)
    int update(Orders orders);

    @Select("""
            select * from orders where merchantId = #{id};
            """)
    List<Orders> findByMerchantId(Integer id);
    @Select("""
            select * from orders where customerId = #{id};
            """)
    List<Orders> findByCustomerId(Integer id);
    @Insert("""
            insert into orders values(null,#{customerId},#{status},#{createTime},#{paymentTime});
            """)
    int insert(Orders orders);
    @Select("""
            select * from orders;
            """)
    List<Orders> findAll();
}
